package com.splider.toutiao;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class ApplicationConfig {
	
	public static Properties prop = new Properties();
	
	static{
		//当前路径
		String path = System.getProperty("user.dir");
		File file = new File(path+File.separator+"splider.properties");
		if(file.exists()){
			try {
				FileInputStream in = new FileInputStream(file);
				prop.load(in);
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}else{
			//每次抓取文章最大条数
			prop.setProperty("max_article_count", "999999999");
			//图片存放文件夹
			prop.setProperty("img_dir", path+File.separator+"img");
			//是否修改图片url前缀
			prop.setProperty("replace_imgUrl_prefix", "0");
			//图片url前缀
			prop.setProperty("imgUrl_prefix", "");
			prop.setProperty("thumb_imgUrl_prefix", "");
			//shell文件
			prop.setProperty("shell", path+File.separator+"s2tw.sh");
			//访问url时的超时时间
			prop.setProperty("time_out", "5000");
			//是否下载图片
			prop.setProperty("download_img", "0");
			//是否使用代理ip
			prop.setProperty("useProxy", "0");
			//出口ip切换shell文件
			prop.setProperty("ipshell", path+File.separator+"transip.sh");
			//出口ip
			prop.setProperty("localIps", "");
			//代理ip获取地址
			prop.setProperty("proxy_url", "");
		}
	}
}
